package edu.nuist.app.controller;

import edu.nuist.app.controller.service.LoginService;
import edu.nuist.app.entity.User;
import edu.nuist.app.response.AjaxResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author wangzhuangzhuang
 * @DESC:
 * @date 2022-04-03 21:24
 */
@RestController
@Slf4j
public class LoginController {

	@Resource
	private LoginService loginService;

	@PostMapping("/user/login")
	public AjaxResponse login(@RequestBody User user){
		log.info("[LoginController] [login] user{}", user);
		AjaxResponse response = loginService.login(user);
		log.warn("[LoginController][login]response: {}", response);
		return loginService.login(user);
	}

}